/**
 * 创建于：2016-5-11
 * 创建人：杨骐彰
 * 说明： 主页面路由配置
 */
import auth from 'auth'
module.exports = {
  path: 'home',
  getComponent(nextState, cb) {
    const  Home = require('./components/home')
    cb(null, Home);
  },
  indexRoute: { onEnter: (nextState, replace) => replace('/home/home') },
  getChildRoutes(location, callback) {
    const
      HomePage = require("./routes/home"),
      Recommend = require("./routes/recommend"),
      Class=require("./routes/class"),
      Revise = require("./routes/revise"),
      Add = require("./routes/addNew"),
      Employment = require("./routes/employment"),
      Adv = require("./routes/adv"),
      Banner = require("./routes/banner"),
      Fensheng = require("./routes/fensheng")

    callback(null, [
      HomePage,
      Recommend,
      Class,
      Revise,
      Add,
      Employment,
      Adv,
      Banner,
      Fensheng
    ]);
  },
  //这里可以验证
  onEnter(nextState, replace){
    if (!auth.isAuthorized()) {
      replace({pathname: 'login'});
    }
  },
};
